#cmake file for test facesdk
#author:NOON47
#created:2019/11/19
cmake_minimum_required( VERSION 3.0 )

cmake_policy(SET CMP0048 NEW)
project( testfacesdk VERSION 1.0.0 LANGUAGES C CXX)
# 查找feature_se库,需要设置 CMAKE_PREIX_PATH 指定 feature_se 的安装路径
# 需要指定CMAKE_MODULE_PATH 指定 FindFse.cmake 的位置
# 本例中的位置在项目根目录下/cmake/Modules
#find_package(facesdkdll REQUIRED)

set(FACESDK_LIBNAME FaceSDKForWin)
if (MSVC)
    set(CompilerFlags
        CMAKE_CXX_FLAGS
        CMAKE_CXX_FLAGS_DEBUG
        CMAKE_CXX_FLAGS_RELEASE
        CMAKE_C_FLAGS
        CMAKE_C_FLAGS_DEBUG
        CMAKE_C_FLAGS_RELEASE
        )
    foreach(CompilerFlag ${CompilerFlags})
        string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
    endforeach()
endif(MSVC)


#寻找OpenCV库
#修改成捏OpenCV路径即可
set(OpenCV_STATIC ON)
if(MSVC)
    set(OpenCV_DIR "dependencies/opencv345")
endif()
#set(OpenCV_INCLUDE_DIRS "${OpenCV_DIR}/include") 
find_package(OpenCV REQUIRED COMPONENTS core highgui imgproc)

set (LIBRARY_INSTALL_DIR ${PROJECT_SOURCE_DIR}/sdk)
include_directories(${LIBRARY_INSTALL_DIR}/include)

##############设置目标文件生成位置#####################
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/lib")
if(MSVC)     
	#关闭C4819警告
	add_definitions("/wd4819")		
	message(STATUS "optional:/wd4819")
endif(MSVC)
# 定义所有的源文件列表  
set(_CPP_SOURCE_FILES
    test.cpp 
    )
# C++调用测试
add_executable(testfacesdk ${_CPP_SOURCE_FILES})
target_link_libraries(testfacesdk ${LIBRARY_INSTALL_DIR}/lib/FaceSDKForWin.lib)
target_link_libraries(testfacesdk ${OpenCV_LIBS})

# Cleanup temporary variables.
set(_CPP_SOURCE_FILES)
#set(_C_SOURCE_FILES)
